Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

g0.135 Resolve problems and bring code to standard #136

Merged
merged 43 commits into from
Jan 24, 2025

Conversation

reynoldtan
Copy link
Contributor

@reynoldtan reynoldtan commented Dec 24, 2024

**Issue #135 ** Resolve Problems and bring up code to standard.

Motivation

What does this PR do?

Please describe each things this PR does. For example, a PR may 1) solve a specific bug, 2) create an automated test to ensure it doesn't return.

  1. Resolve problems detected by PHP Sniffer & Beautifier, problems like
  • Use of \Drupal::service construct (Use DI to resolve this type).
  • Comments exceeding 80 characters.
  • Unused use statements and variables.
  • Required space between foreach and ().
  1. Upgrade automated test to use Phenotypes Traits and data provider.

Testing

Automated Testing

Please describe each automated test this PR creates and provide a list of the assertions it makes using casual language.
Do not just say things like "asserts the array is not empty" but rather say "Ensures that the return value of method X with these parameters is not an empty array".

The following tests have been revised

  • test/src/Kernel/ServiceGenusOntologyTest.php
  • test/src/Kernel/ServiceGenusProjectTest.php
  • test/src/Kernel/ServiceTermTest

Manual Testing

Describe in detail how someone should manually test this functionality.
Make sure to include whether they need to build a docker from scratch, create any records, etc.

  • Load the following files and confirm that for each file the problems tab should show 0 problem.

image

  • src/Controller/TripalCultivatePhenotypesSettings.php
  • src/Form/TripalCultivatePhenotypesOntologySettingsForm.php
  • src/Form/TripalCultivatePhenotypesRSettingsForm.php
  • src/Form/TripalCultivatePhenotypesWatermarkSettingsForm.php
  • tests/src/Functional/ConfigOntologyTermsTest.php
  • test/src/Functional/ConfigRRulesTest.php
  • test/src/Functional/ConfigWatermarkTest.php
  • test/src/Functional/InstallTest.php
  • test/src/Unit/ConfigRRulesFormTest.php
  • test/src/Unit/ConfigWatermarkFormTest.php
  • test/src/Kernel/ServiceGenusOntologyTest.php
  • test/src/Kernel/ServiceGenusProjectTest.php
  • test/src/Kernel/ServiceTermTest

@reynoldtan reynoldtan self-assigned this Jan 2, 2025
@reynoldtan reynoldtan linked an issue Jan 2, 2025 that may be closed by this pull request
16 tasks
@reynoldtan reynoldtan changed the title Fixes TripalCultivatePhenotypesSettingsController g0.135 Resolve problems and bring code to standard Jan 6, 2025
@reynoldtan reynoldtan marked this pull request as ready for review January 13, 2025 21:47
Copy link
Contributor

@carolyncaron carolyncaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reviewed the classes so far and made a couple of suggestions. I should get to reviewing tests on Friday. Overall, it's looking very polished!

Classes:

  • src/Controller/TripalCultivatePhenotypesSettings.php
  • src/Form/TripalCultivatePhenotypesOntologySettingsForm.php
  • src/Form/TripalCultivatePhenotypesRSettingsForm.php
  • src/Form/TripalCultivatePhenotypesWatermarkSettingsForm.php
  • src/Service/TripalCultivatePhenotypesGenusOntologyService.php
  • src/Service/TripalCultivatePhenotypesGenusProjectService.php
  • src/Service/TripalCultivatePhenotypesTermsService.php
  • src/Service/TripalCultivatePhenotypesTraitsService.php

Copy link
Member

@laceysanderson laceysanderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove ConfigWatermarkFormTest::testBuildForm() and testValidateForm()?

@reynoldtan
Copy link
Contributor Author

Why did you remove ConfigWatermarkFormTest::testBuildForm() and testValidateForm()?

I could not make this two test methods to pass since I updated the form controller to use DI 🙈 This is a unit test that I would like to replace with a kernel test.

root and others added 19 commits January 17, 2025 18:57
…esSettingsController.php

Co-authored-by: Lacey-Anne Sanderson <[email protected]>
…enusOntologyService.php

Co-authored-by: Lacey-Anne Sanderson <[email protected]>
…enusOntologyService.php

Co-authored-by: Lacey-Anne Sanderson <[email protected]>
…enusOntologyService.php

Co-authored-by: Carolyn T Caron <[email protected]>
laceysanderson
laceysanderson previously approved these changes Jan 23, 2025
Copy link
Member

@laceysanderson laceysanderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks good to me now. All my previous suggestions were addressed ✅

Why did you remove ConfigWatermarkFormTest::testBuildForm() and testValidateForm()?

Not only was this test restored but we now have both unit and kernel for build and validate. Since the unit tests are blazingly fast (apparently 00:00.124 which felt instant to me), I think it's fine to have the overlap. The new tests accomplish the same thing/coverage the original ones did with added messages to the asserts.

There is one unit test for the submit that has no asserts that should be removed (see suggestion). Since this is covered in the new kernel tests, I think it is fine to delete it from the unit tests.

Copy link
Contributor

@carolyncaron carolyncaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything from me has been addressed! ✅

Copy link
Member

@laceysanderson laceysanderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay! Looks ready to merge!

@reynoldtan reynoldtan merged commit 547d8b6 into 4.x Jan 24, 2025
21 checks passed
@reynoldtan reynoldtan deleted the g0.135-resolveProblemsAndBringToStandard branch January 24, 2025 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

G0.135 - Resolve Problems and Bring to Standard
3 participants